package com.eagle.functioninterface;

import org.junit.Test;

import java.util.function.ObjDoubleConsumer;
import java.util.function.ObjIntConsumer;
import java.util.function.ObjLongConsumer;

/**
 * Obj + int/long/double +Consumer组成的函数式接口
 * 下面这个三个函数式接口都可以看成是{@link java.util.function.BiConsumer}特殊形式
 * {@link java.util.function.ObjIntConsumer}
 * {@link java.util.function.ObjLongConsumer}
 * {@link java.util.function.ObjDoubleConsumer}
 *
 * @author qinlinsen
 */
public class ObjOutputConsumerTest18 {
    @Test
    public void testObjIntConsumer() {
        ObjIntConsumer<String> f = (x, y) -> System.out.println(Integer.parseInt(x) + y);
        f.accept("3", 4);
    }

    @Test
    public void testObjDoubleConsumer() {
        ObjDoubleConsumer<String> f = (x, y) -> System.out.println(Double.parseDouble(x) + y);
        f.accept("8", 4);
    }


    @Test
    public void testObjLongConsumer() {
        ObjLongConsumer<String> f = (x, y) -> System.out.println(Long.parseLong(x) + y);
        f.accept("6", 4);
    }
}
